package com.zrgk.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.zrgk.bean.ConPlanBean;
import com.zrgk.dao.ConPlanDao;
import com.zrgk.util.PageUtil;




@Service(value = "conPlanService")
@Transactional(propagation = Propagation.REQUIRED)
public class ConPlanServiceImpl implements ConPlanService {
	@Autowired
	@Qualifier("conPlanDao")
	private ConPlanDao conPlanDao;

	public List<ConPlanBean> listConPlan() {
		
		return conPlanDao.listConPlan();
	}

	public void insertConPlan(ConPlanBean conp) {
		
		conPlanDao.insertConPlan(conp);	
	}
	
	public void updateConPlan(ConPlanBean conp){
		
		conPlanDao.updateConPlan(conp);
	}

	public ConPlanDao getConPlanDao() {
		return conPlanDao;
	}

	public void setConPlanDao(ConPlanDao conPlanDao) {
		this.conPlanDao = conPlanDao;
	}

	public void findConPlanByPage(PageUtil pageUtil) {
//		Page page = PageHelper.startPage((pageUtil.getNowPage()-1)*pageUtil.getPageSize(),pageUtil.getPageSize());
		List<ConPlanBean> conp = conPlanDao.listConPlan();
		for(ConPlanBean c:conp){
			System.out.println(c);
		}
		pageUtil.setList(conp);
//		pageUtil.setTotalCount(page.getPages());
//		pageUtil.setTotalPage((int)page.getTotal());	
	}
			
	public ConPlanBean findConPlanById(int id) {
		
		return conPlanDao.ConPlanById(id);
	}

}
